<template>
	<view class="big-box flex-col align-center">
		<top-navigation bgColor='#FFFFFF00' :isBack="true" isFix isShow>
			<text slot='center-slot' class="center-slot">开蛋记录</text>
			
		</top-navigation>
		<u-toast ref="uToast"></u-toast>
		<view class="no-data-box flex-col justify-center align-center" v-if="!eggInfoList.length">
			<image class="no-data" src="/static/images/no-datapng.png" mode=""></image>
			暂无数据
		</view>
		<!-- 我的baby -->
		<!-- <view class="top-box" @tap="$navto('/pages/mine/long/long')">
			<view class="flex-col justify-center align-center"> 
			<image class="long-baby" src="/static/images/mine/open_log.png" mode=""></image>
				<view class="long-num">
					0 
				</view>
				<view class="my-qing-long">
					我的青龙 <text class="unit"> (只)</text>
				</view>
			</view>
		</view> -->
		<view class="content">
			<!-- <view class="content-box justify-between align-center" v-for="v,k in eggInfoList" :key="k"> -->
			<view class="content-box justify-between align-center" v-for="v,k in eggInfoList" :key="k">
				<view class="justify-start align-center">
					<view class="longdan-box justify-center align-center"
						:style="{background:`url(${v.image}) no-repeat center center / 100% 100%`}">
						<!-- <image class="longdan" :src="v.image" mode="widthFix"></image> -->
					</view>
					<view class="title">
						{{v.name}}
						<view class="time">
							{{v.desc}}
						</view>
					</view>
				</view>
				<view class="title flex-col align-end">
					{{v.number}}
					<view class="time">
						{{v.ctime_text}}
					</view>
				</view>
		
			</view>
		</view>
		
		
		<!-- 联系客服弹出层-->
		<u-popup :show="moneyShow" mode="center" @close="moneyShow=false" round="16rpx" bgColor='transparent'
			overlayOpacity='0.85'>
			<view class="popup-one-box flex-col align-center">
				<image class="popup-top-bg" src="/static/images/starmap/popup_top-bg.png" mode=""></image>
				<view class="popup-top-gaoji">
					<image class="gao-ji" src="/static/images/starmap/high-map.png" mode=""></image>
				</view>
				<view class="has-shuijing justify-start">
					拥有钻石: <text class="shui-ji-num">0</text> 个
				</view>
				<view class="need-kuang justify-between align-center">
					<view class="need-shuijing">
						需消耗的钻石
					</view>
					<view class="need-shuijing-num justify-start align-center">
						<image class="popup-kuangshi" src="/static/images/starmap/kuangshi.png" mode=""></image>
						100
					</view>
				</view>
				<view class="popup-box-btn align-center justify-center" @click="openMap">
					{{'开启地图'}}
				</view>
				<view class="popup-box-cancel align-center justify-center" @click="moneyShow=false">
					<image class="close-popup" src="/static/images/starmap/close.svg" mode=""></image>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {

		data() {
			return {
				current: 0,
				moneyShow: false,
				hotList: [{
						url: '/static/images/mine/order-all.svg',
						title: '全部'
					},
					{
						url: '/static/images/mine/order-dai.svg',
						title: '待付款'
					},
					{
						url: '/static/images/mine/order-fa.svg',
						title: '待发货'
					},
					{
						url: '/static/images/mine/order-shou.svg',
						title: '待收货'
					},

				],

				appList: [

				],
				loading:false,
				eggInfoList:[],
				page: 1,
				pagesize: 0,
				totalpage: 0,


			}
		},
		onLoad() {
			this.getIndex()
		},
		onReachBottom(){
			if(this.loading) return
				let  reach =Number(this.page)  >= Number(this.totalpage) 
				    if(!reach){
						this.loading = true
		                //当前条数小于总条数 则增加请求页数
				        this.page ++;
						this.getIndex(true) //调用加载数据方法
				    }else{
				        console.log('已加载全部数据')
				    }
		},
		methods: {
			// 开蛋记录
			async getIndex(e) {
				let url = '/api/v1/open_egg_log'
				let {
					code,
					msg,
					data
				} = await this.$getRequest(url,{
					page: this.page,
				})
				if (code == 200) {
					console.log(data, '静态资源');
					if (e) {
						// this.status = 'loadmore'
						this.eggInfoList = [...this.eggInfoList, ...data.list]
					} else {
						this.eggInfoList = data.list
					}
					this.page = data.page //"1",/
					this.pagesize = data.pagesize //"20",
					this.totalpage = data.totalpage //"1"
					
				} else {
					this.$refs.uToast.show({
						message: msg
					})
				}
				this.loading = false
			},
			myCopy(value) {
				let _this = this
				//提示模板
				uni.setClipboardData({
					data: value, //要被复制的内容
					showToast: false,
					success: () => { //复制成功的回调函数
						_this.$refs.uToast.show({
							message: '已复制',
							type: 'default',
							duration: '500'

						})
						// uni.showToast({ //提示
						// 	title: wxorqq == 'w' ? "微信号已复制" : 'QQ号已复制'
						// })
					}
				});
			},
			bannerTap() {
				// banner点击
			},
			bannerChange() {
				// banner改变
			},
			featureTap(e) {
				this.moneyShow = true
			}
		}
	}
</script>
<style>
	@import '/common/css/common.css';
</style>
<style lang="scss" scoped>
	.big-box {
		min-height: 100vh;
		background: #16161e;
		padding: 0 32rpx 60rpx;
		.content {
			margin-top: 40rpx;
			width: 100%;
			color: #FFF;
		
			.content-box {
				margin-bottom: 40rpx;
				.time {
					margin-top: 23rpx;
					font-size: 24rpx;
					color: #6e6e76;
				}
		
				.longdan-box {
					width: 56rpx;
					height: 80rpx;
					margin-right: 15rpx;
				}
		
				.longdan {
					width: 56px;
					height: 80px;
				}
			}
		
			.title {
				// margin-bottom: 23rpx;
				font-size: 28rpx;
			}
		}
		
		.no-data-box{
			
			position: fixed;
			top: 40%;
			left: 50%;
			transform: translate(-50%,-50%);
			color: #FFFFFFCC;
			font-size: 28rpx;
			
		}
		.no-data{
			width: 220rpx;
			height: 220rpx;
			margin-bottom: 30rpx;
		}
		.center-slot {
			color: #FFF;
		}

	}

	

	.top-box {
		width: 100%;
		position: relative;
		margin: 83rpx auto 26rpx;
		padding: 26rpx 32rpx;
		border-radius: 16rpx;

		.long-baby {
			position: absolute;
			top: 40rpx;
			right: 0;
			width: 96rpx;
			height: 96rpx;
		}

		.my-qing-long {
			color: #FFFFFFCC;
			font-size: 24rpx;
			.unit {
				margin-left: 15rpx;
			}
		}

		.long-num {
			margin: 20rpx 0 26rpx;
			font-size: 80rpx;
			color: #27ff92;

			
		}
	}

	.popup-one-box {
		position: relative;
		z-index: 7;
		width: 560rpx;
		border-radius: 16rpx;
		background: linear-gradient(181deg, rgba(35, 52, 73, .94) 20%, #181922 100%);
		padding: 90rpx 40rpx 40rpx;

		.has-shuijing {
			width: 100%;
			height: 44rpx;
			font-size: 28rpx;
			color: #FFFFFF99;
			margin-bottom: 24rpx;
		}

		.shui-ji-num {
			font-size: 28rpx;
			color: #FFF;
			font-weight: 700;
		}

		.popup-box-btn {
			width: 480rpx;
			height: 90rpx;
			background: #8e929b;
			color: #202426;
			font-size: 30rpx;
			border-radius: 8rpx;
			font-weight: 700;
		}

		.popup-box-cancel {
			position: absolute;
			left: 50%;
			transform: translate(-50%, 0);
			bottom: -120rpx;
		}

		.close-popup {
			width: 48rpx;
			height: 48rpx;
		}

		.popup-kuangshi {
			width: 56rpx;
			height: 36rpx;
		}

		.need-kuang {
			width: 480rpx;
			height: 120rpx;
			background: rgba(46, 70, 86, .41);
			border-radius: 8rpx;
			padding: 0 20rpx;
			margin-bottom: 40rpx;

			.need-shuijing {
				font-size: 22rpx;
				color: #FFFFFF99;
			}

			.need-shuijing-num {
				font-size: 28rpx;
				font-weight: 700;
				color: #FFF;
			}
		}

		.popup-top-bg {
			position: absolute;
			width: 100%;
			left: 0;
			top: 0;
			right: 0;
			z-index: -1;
			height: 108rpx;
		}

		.popup-top-gaoji {
			position: absolute;
			top: 40rpx;
			right: 30rpx;

			.gao-ji {
				width: 156rpx;
				height: 35rpx;
			}
		}

	}
</style>